import React from 'react';
import CommonList from '../../../components/CommonLists/list';
import { Button } from 'antd';

class PolicyList extends CommonList {
  constructor(props) {
    super(props);
    this.editButton = record => {
      return (
        <Button
          size='small'
          type='link'
          onClick={this.edit.bind(this, record)}
          disabled={record.audit_status === this.AUDIT._WAIT}
        >
          编辑
        </Button>
      );
    };
    this.copyButton = record => {
      return (
        <Button
          size='small'
          type='link'
          disabled={record.audit_status === this.AUDIT._WAIT}
          onClick={this.copy.bind(this, record)}
        >
          复制
        </Button>
      );
    };
    this.delButton = record => {
      return (
        <Button
          size='small'
          type='link'
          disabled={record.audit_status === this.AUDIT._WAIT}
          onClick={this.delete.bind(this, record)}
        >
          删除
        </Button>
      );
    };
    this.btnGroup = [this.editButton, this.copyButton, this.delButton];
  }

  // 删除时的参数
  getDeleteParam = record => {
    return { strategy_id: record.strategy_id };
  };

  edit = record => {
    this.props.edit(record);
  };

  delete = record => {
    this.props.delete(record);
  };
}

export default PolicyList;
